package com.atstudy.other;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/23 15:54
 * @copyright: 博为峰
 */
public class DeadLock02 implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + ",DeadLock02 开始执行");
        synchronized (DeadTest.obj2){
            System.out.println(Thread.currentThread().getName() + ",DeadLock02 拿到 lock2锁");
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            synchronized (DeadTest.obj1){
                System.out.println(Thread.currentThread().getName() + ",DeadLock02 拿到 lock1锁");
            }
        }
    }
}
